package com.demo.controller;


import com.demo.domain.CtCommodityImgarr;
import com.demo.service.impl.CtCommodityImgarrServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (CtCommodityImgarr)表控制层
 *
 * @author makejava
 * @since 2021-07-06 16:10:00
 */
@RestController
public class CtCommodityImgarrController {
    /**
     * 服务对象
     */
    @Resource
    private CtCommodityImgarrServiceImpl ctCommodityImgarrService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne5")
    public List<CtCommodityImgarr> selectOne(Integer id) {
        System.out.println(id);
        return this.ctCommodityImgarrService.queryById(id);
    }
    @GetMapping("selectAll5")
    public List<CtCommodityImgarr> selectAll(){
        return this.ctCommodityImgarrService.queryAllByLimit();
    }
    @PostMapping("insertById5")
    public CtCommodityImgarr insertById(CtCommodityImgarr ctCommodityImgarr){
        return this.ctCommodityImgarrService.insert(ctCommodityImgarr);
    }
    @PostMapping("updateById5")
    public CtCommodityImgarr updateById(CtCommodityImgarr ctCommodityImgarr){
        return this.ctCommodityImgarrService.update(ctCommodityImgarr);
    }
    @PostMapping("deleteById5/{id}")
    public boolean deleteById(@PathVariable int id){
        return this.ctCommodityImgarrService.deleteById(id);
    }
}